package com.niiwoo.civet.trade.enums;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: wuke
 * @Description: 统计数据类型枚举，对应t_tc_statistics_info表statistics_type字段
 * @Date: Created in 18:02 2017/12/29
 */
@AllArgsConstructor
@Getter
public enum StatisticsTypeEnum {
    REGISTER_USER_COUNT("10000","registerUserCount","注册用户数-全部userid数量",TradeConfigEnum.initial_register_User_Count),
    APPLY_LOAN_USER_COUNT("10001","applyLoanUserCount","申请借款人数-提交借款申请的人数",TradeConfigEnum.initial_apply_loan_user_count),
    TODAY_REGISTER_USER_COUNT("10002","todayRegisterUserCount","今日注册用户数-今日新增的userid数量",TradeConfigEnum.initial_today_register_user_count),
    CUMULATIVE_TRADE_AMOUNT("10003","cumulativeTradeAmount","累计交易金额-成功满标的合同金额",TradeConfigEnum.initial_cumulative_trade_amount),
    OPERATE_DAYS("10004","operateDays","安全运营天数-公司成立至今的天数",null),
    APPLY_LOAN_AMOUNT("10005","applyLoanAmount","申请借款金额-提交借款申请的合同金额；包括：系统拒绝的、人工审核通过的、人工审核退回的、审核不通过的、提交到后台用户自己取消借款的  等多个状态",TradeConfigEnum.initial_apply_loan_amount),
    CUMULATIVE_USER_PROFIT("10006","cumulativeUserProfit","用户赚取收益-已到账的利息+已到账的加息收益+已到账的罚息+已到账的投资返现+已到账的平台奖励+已到账的尽调收益+已到账的担保收益",TradeConfigEnum.initial_cumulative_user_profit);

    //统计数据类型
    private String statisticsType;
    //统计数据字段名称
    private String statisticsFieldName;
    //统计数据类型描述
    private String statisticsTypeDesc;
    //初始值配置KEY枚举
    private TradeConfigEnum initialStatisticsEnum;

    public static StatisticsTypeEnum enumOf(String statisticsType) {
        for (StatisticsTypeEnum statisticsTypeEnum : values()) {
            if (statisticsTypeEnum.getStatisticsType().equals(statisticsType)) {
                return statisticsTypeEnum;
            }
        }
        throw new NoSuchEnumValueException("未找到对应StatisticsTypeEnum枚举，statisticsType：" + statisticsType);
    }
}
